import javax.imageio.IIOException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class Demo4 {
    public static void main(String[] args) throws IIOException {
        try(OutputStream outputStream = new FileOutputStream("./test2.txt",true)) {
            //第二个参数的 true ,表示 "追加写" 方式,此时文件原有内容还是会存在,新写的内容会追加在末尾
            outputStream.write(97);
            outputStream.write(98);
            outputStream.write(99);
            outputStream.write(100);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
